<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/7/17
 * Time: 15:20
 */

namespace app\common\service\sms;


class Sms
{

    public static $sendType;
    private $smsService;

    public function __construct($sendType = 1, $smsType = 1)
    {
        self::$sendType = $sendType;
        $this->_createSms($smsType);
    }

    /**
     * 发送短信
     * @param $mobile
     * @param $param
     */
    public function sendSms($mobile, $param){
        $res = $this->smsService->sendSms($mobile, $param);
        return $res;
    }

    /**
     * 选择发送方式
     * @param $smsType
     */
    private function _createSms($smsType){
        switch (self::$sendType){
            case 1:
                //阿里云短信
                $this->smsService = new AliyunSms($smsType);
                break;
            default:
                break;
        }
    }

}